package com.leyou.page.controller;

import com.leyou.page.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * @author syf
 * @version 1.0
 * @date 2019/08/09 20:06
 * @Description TODO:商品详情控制器
 */
@Controller //经过解析器
public class PageController {

    @Autowired
    private PageService pageService;

    @RequestMapping("/item/{id}.html")
    public String toItemPage(@PathVariable("id") Long id, Model model){
        Map<String,Object> map=pageService.loadItemData(id);
        model.addAllAttributes(map);
        return "item";
    }
}
